import { createStore } from "vuex";
import ljStore from "./personalStore/ljStore";
import csStore from "./personalStore/csStore";
import mypStore from "./personalStore/mypStore";
import xhStore from "./personalStore/xhStore";
import lshStore from "./personalStore/lsyStore";
import lhStore from "./personalStore/lhStore";
import API from '@/api'
let store = createStore({
  state() {
    return {
      //登陆底部复选框按钮
      botChecked: false,
      telphone: "", //用户手机
      
      typeObj:{},
      //筛选剧本类型
      scriptList:'',
      

      //后端服务器图片地址
      imgs:'http://115.227.16.200:8003'
    };
  },
  getters: {
    
  },
  mutations: {
    setBotChecked(state, a) {
      state.botChecked = a;
    },
    setPhoneNum(state, tel) {
      state.telphone = tel;
    },
    setTypeObj(state,a){
      state.typeObj = a
      console.log(a);
    },
    setscriptList(state,a){
      state.scriptList = a
    }
  },
  actions: {
    //按条件筛选剧本
    setTypeObj(context,a){
      API.getScriptAll(a).then(({ data }) => {
        context.commit('setscriptList',data.data)
      });
    }
  },
  modules: {
    ljStore,
    csStore,
    mypStore,
    xhStore,
    lhStore,
    lshStore,
  },
});
export default store;
